package com.zsr.example.controller;


import com.alibaba.fastjson.JSONObject;
import com.zsr.example.config.annotation.RequiresPermissions;
import com.zsr.example.service.TOrderService;
import com.zsr.example.util.CommonUtil;
import com.zsr.example.util.PageUtil;
import com.zsr.example.vo.OrderReq;
import com.zsr.example.vo.TOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 订单 后端控制器
 * </p>
 *
 * @author zsr
 * @since 2021-12-06
 */
@RestController
@CrossOrigin
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private TOrderService orderService;


    @RequiresPermissions("order:list")
    @PostMapping("pageListOrderCondition")
    public JSONObject pageListLogCondition(
            @RequestBody(required = false) OrderReq orderReq) {//@RequestBody

        List<TOrderVo> tOrderVos = orderService.orderQueryPage(orderReq);
        List<TOrderVo> build = PageUtil.build(orderReq, tOrderVos);
        return CommonUtil.successPage(tOrderVos.size(), build);
    }





}

